home *** CD-ROM | disk | FTP | other *** search
/ F1 Licenseware / F1 Licenseware - Volume 1.iso / disks / 003.dms / 003.adf / EXAMPLE_PROGRAMS / example17.AMOS / example17.amosSourceCode
AMOS Source Code  |  1993-02-25  |  2KB  |  67 lines

  1. Rem example17.Amos 
  2. '
  3. Rem A very simple program using dimensioned arrays and procedures
  4. '
  5. '
  6. Rem s is a variable to tell us if the teams have been sorted or not
  7. Rem if s=0 then not sorted if s=1 then teams are sorted
  8. S=0
  9. '
  10. '
  11. Rem Dimension an array called team$ with 22 entries the array counts from 0. 
  12. Dim TEAM$(21)
  13. '
  14. '
  15. Rem make the variables s and team$() (array) accessable inside procedures  
  16. Global S,TEAM$()
  17. '
  18. '
  19. Rem make sure the data pointer is at the beginning of data line. 
  20. Restore TEAMDATA
  21. '
  22. '
  23. Rem using a for next loop read the data into team$(a)
  24. For A=0 To 21
  25. Read TEAM$(A)
  26. Next A
  27. '
  28. '
  29. Rem call the procedure called _showteams to,  show the teams.  
  30. _SHOWTEAMS
  31. '
  32. '
  33. Rem call procedure to sort the teams into order  
  34. _SORTTEAMS
  35. '
  36. '
  37. Rem call showteams again to reprint the teams that are now sorted
  38. _SHOWTEAMS
  39. '
  40. '
  41. Rem to open a procedure, click mouse on line then click on FOLD/UNFOLD   
  42. Rem at top of screen (2nd box from left) 
  43. Procedure _SHOWTEAMS
  44. Curs Off : Paper 0 : Hide : Cls 0
  45. For A=0 To 21
  46. Locate 14,A : Print TEAM$(A)
  47. Next A
  48. Locate 0,24
  49. If S=0 Then Centre "PRESS A KEY TO SORT TEAMS"
  50. If S=1 Then Centre "TEAMS SORTED"
  51. Clear Key : Wait Key 
  52. End Proc
  53. '
  54. '
  55. Rem the actual sortteams procedure unfold this too 
  56. Procedure _SORTTEAMS
  57. Sort TEAM$(0)
  58. S=1
  59. End Proc
  60. '
  61. '
  62. Rem this is the team data that gets read into team$(a) 
  63. TEAMDATA:
  64. Data "ARSENAL","SPURS","ASTON VILLA","LEEDS","CHELSEA","OLDHAM"
  65. Data "MAN UTD","MAN CITY","IPSWICH","SWINDON","SOUTHAMPTON","BLACKBURN"
  66. Data "NEWCASTLE","WIMBELDON","LIVERPOOL","WEST HAM","COVENTRY","EVERTON"
  67. Data "SHEFF UTD","SHEFF WED","Q.P.R","NORWICH"